package com.zr.meiju;

/**
 * Created by Administrator on 2019/10/9.
 */
public enum  StatusEnum {
    JINYONG(0,"禁用"),QIYONG(1,"启用");


    private final String statusName;
    private final Integer statusValue;

    private StatusEnum(Integer statusValue,String statusName)
    {
        this.statusName = statusName;
        this.statusValue = statusValue;
    }

    public String getStatusName() {
        return statusName;
    }

    public Integer getStatusValue() {
        return statusValue;
    }

    // 通过值取名称
    public static String getName(int statusValue) {
        for (StatusEnum c: StatusEnum.values()){
            if(c.getStatusValue()==statusValue){
                return c.getStatusName();
            }
        }
        return null;
    }
    // 通过名称取值
    public static Integer getValue(String statusName) {
        for (StatusEnum c : StatusEnum.values()) {
            if (c.getStatusName().equals(statusName)) {
                return c.getStatusValue();
            }
        }
        return null;
    }


}
